Skip to content

A run held by the token limit reads as paused, and admins hear before the limit runs out - #514

Merged
coderhelm[bot] merged 2 commits into
mainfrom
token-limit-pauses
Dec 1, 2026
Merged

coderhelm[bot] merged 2 commits into
mainfrom
token-limit-pauses

Conversation

@nambok

@nambok nambok commented Dec 1, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

A run held by the team's monthly token limit starts again by itself, so it no longer shows as "Needs a person". The run page says when it resumes, in the viewer's own time zone, with a link to the limit setting and no Retry. Admins and owners also get a banner before a limit runs out, at 80% and again at 95%, with the date it runs out at this month's pace.

Pairs with CoderHelm/coderhelm-platform#937, which adds the fields this reads. Every new field is optional, so an older backend renders as before.

Changes

  • Run page: when waiting_on.pause is set on a needs_input run, the outcome card reads "Paused" (token_limit) or "Waiting for token room" (token_room), with a "Resumes by itself" chip, one line such as "Paused: this month's token limit is used up (40.3M of 40M). Resumes by itself on Mon, Nov 30, 7:00 PM EST when the month turns, or as soon as an admin raises the limit.", and a "Token limit settings" link. No Retry is offered. The timeline's last step and heading say the same, as a wait rather than a person's task. Every other needs_input run keeps the "Needs a person" card.
  • Status badge: RunStatusBadge takes the pause kind and reads "Paused" or "Waiting for token room" in a calm info tone. The runs list and the command palette don't receive waiting_on from the list endpoint, so they keep the status word they have today.
  • Banners: admins and owners see a dismissible warning when a limit is at 80% (amber) or 95% (stronger), with "At this pace it runs out on ..." from projected_at in their own zone, and a link to the limit setting. Each level shows once per month and limit (stored with the existing dismissed-banner list). The reached-limit banner still comes first and now says paused runs resume by themselves.
  • Types: RunPause and RunWaitingOn.pause in lib/api.ts; warn_level and projected_at on TokenLimitUse; helpers in lib/usage.ts (pauseLine, pauseLabel, formatWhenLocal, warnedLimit, warnBannerId).
  • openapi-fields.ts is unchanged: it is generated from the platform's committed OpenAPI document, and the contract checks don't cover RunWaitingOn or UsageLimit. It can be regenerated once the platform change lands.

Verification

  • npm run lint, npm run typecheck and npm run build in dashboard/ pass.
  • New e2e/token-limit-pauses.spec.ts (8 tests, mocked API, viewer in America/New_York): a paused run shows the line with the viewer-zone time, the settings link, no "Needs a person" and no Retry; a token-room run; a run waiting on a person still shows "Needs a person"; the 80% and 95% banners with the projected date, dismissed and staying dismissed for that month and level, then back for a new month; members get no warning; the reached banner still shows and wins.
  • Related specs re-run: shell-menu, run-questions, close-runs, run-draft-hold, run-log-tab, stop-rules, list-and-palette, run-steps, audit-shell, webhooks, round-incomplete, run-activity. 134 passed in total.
  • Before and after screenshots of the paused run page and the 95% banner taken in the dark theme at 1440 and 390 widths.

… the limit runs out

A run waiting on the monthly token limit (waiting_on.pause) shows one line with when it resumes, in the viewer's own time zone, a link to the limit setting and no Retry; its badge reads Paused or Waiting for token room, never Needs a person. Admins and owners get a banner at 80% and at 95% of a limit with the projected run-out date, once each per month and limit. The reached-limit banner says paused runs resume by themselves.
@nambok nambok added the ch-review CoderHelm reviews this pull request label Dec 1, 2026
coderhelm[bot]

This comment was marked as outdated.

@coderhelm

coderhelm Bot commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

🟡 Post-merge health check: deploy cancelled: the deploy for 456b1b1 was cancelled; nothing later deployed it.

  • Customer details guard rerun (cancelled, started 2026-12-01T04:20:50Z)
    No new failures in what ran. Run the deploy again if this commit should go out.
    Auto-merge
    The rest is in the pull request description.

@coderhelm coderhelm Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Approved with notes 6e99e19 (merged)

@coderhelm
coderhelm Bot merged commit 456b1b1 into main Dec 1, 2026
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ch-review CoderHelm reviews this pull request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant